package com.zego.wawaji.ui.bean.wawa;

import android.os.Parcel;
import android.os.Parcelable;

import com.zego.wawaji.base.data.BaseData;

import org.json.JSONObject;

/**
 * 娃娃机房间状态：解析长连接消息
 * Created by Su on 2017/12/9.
 */
public class RoomStatus extends BaseData implements Parcelable{

    private long rid;    // 房间自增id
    private int wwjStatus; // 房间状态  1：空闲中  -1：游戏中  -2：休息 -3：维修

    @Override
    public void parseJson(String jsonStr) {
        JSONObject jsonObject = getJsonObject(jsonStr);

        this.setRid(jsonObject.optLong("Rid"));
        this.setWwjStatus(jsonObject.optInt("WwjStatus"));
    }

    public long getRid() {
        return rid;
    }

    public void setRid(long rid) {
        this.rid = rid;
    }

    public int getWwjStatus() {
        return wwjStatus;
    }

    public void setWwjStatus(int wwjStatus) {
        this.wwjStatus = wwjStatus;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.rid);
        dest.writeInt(this.wwjStatus);
    }

    public RoomStatus() {
    }

    protected RoomStatus(Parcel in) {
        this.rid = in.readLong();
        this.wwjStatus = in.readInt();
    }

    public static final Creator<RoomStatus> CREATOR = new Creator<RoomStatus>() {
        @Override
        public RoomStatus createFromParcel(Parcel source) {
            return new RoomStatus(source);
        }

        @Override
        public RoomStatus[] newArray(int size) {
            return new RoomStatus[size];
        }
    };
}
